import random

# 定义卡片类
class Card:
    def __init__(self, name, star):
        self.name = name
        self.star = star

    def __str__(self):
        return f"{self.name}（{self.star}星）"

# 定义卡片池
card_pool = [
    Card("卡片 A", 1), Card("卡片 B", 1), Card("卡片 C", 1),
    Card("卡片 D", 2), Card("卡片 E", 2),
    Card("卡片 F", 3)
]

# 定义星级概率
star_probabilities = {
    1: 0.7,
    2: 0.2,
    3: 0.1
}

# 定义玩家类
class Player:
    def __init__(self):
        self.cards = []
        self.currency = 100

    def draw_card(self):
        if self.currency < 10:
            print("货币不足，无法抽卡。")
            return
        self.currency -= 10
        random_num = random.random()
        cumulative_prob = 0
        for star, prob in star_probabilities.items():
            cumulative_prob += prob
            if random_num < cumulative_prob:
                available_cards = [card for card in card_pool if card.star == star]
                drawn_card = random.choice(available_cards)
                self.cards.append(drawn_card)
                print(f"你抽到了：{drawn_card}")
                break

    def show_cards(self):
        if not self.cards:
            print("你还没有卡片。")
        else:
            print("你拥有的卡片：")
            for card in self.cards:
                print(card)

# 主游戏循环
def main():
    player = Player()
    while True:
        print("\n请选择操作：")
        print("1. 抽卡（每次 10 货币）")
        print("2. 查看卡片")
        print("3. 退出游戏")
        choice = input("请输入选项编号：")
        if choice == "1":
            player.draw_card()
        elif choice == "2":
            player.show_cards()
        elif choice == "3":
            print("游戏结束，感谢游玩！")
            break
        else:
            print("无效的选项，请重新输入。")

if __name__ == "__main__":
    main()